﻿@{
    Layout = null;
}
@model  ElingOA6_Admin_DSJCJ.Areas.Admin.Controllers.SchedulerDataObject
<!DOCTYPE html>
<html>
@*@Html.Partial("LoadPanelPartial")*@
<head>
    <title>日历管理</title>
    @if (false)
    {
    
        <script src="../../../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
    }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/My97DatePicker/WdatePicker.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/json2.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui.min.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/regex.js", true)" type="text/javascript"></script>
    @Html.DevExpress().GetStyleSheets(
     new StyleSheet { ExtensionType = ExtensionType.Scheduler, Theme = DevExpressHelper.Theme },
                new StyleSheet { ExtensionType = ExtensionType.Button, Theme = DevExpressHelper.Theme },
                        new StyleSheet { ExtensionType = ExtensionType.PopupControl, Theme = DevExpressHelper.Theme },
                          new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme }


)
    @Html.DevExpress().GetScripts(
             new Script { ExtensionType = ExtensionType.ListBox },
                    new Script { ExtensionType = ExtensionType.Scheduler },
                            new Script { ExtensionType = ExtensionType.PopupControl },
                             new Script { ExtensionType = ExtensionType.Button }

    )
    <script type="text/javascript">
//<![CDATA[
       

        $(document).ready(function () {
           // setInterval("myInterval()", 5000);

            var msg = '@ViewBag.Msg';
            if (msg!=""&msg!=null) {
                if (msg == 'ok') {

                    // ASPxClientPopupControl.Cast("popfirst").Hide();
                    // parent.codeOK();
                    window.location.href = '@Url.Action("Index", "Calendar")';
                }
                else {
                    alert(msg);
                    window.location.reload();
                }

            }
            var hdjsAlert = $("#hdjsAlert").val();


            if (hdjsAlert != "" & hdjsAlert !=null) {
               alert(hdjsAlert);
            }
        });
      
     
        function openshow() {
            ASPxClientPopupControl.Cast("popfirst").Show();

        }
        function closepop() {
            ASPxClientPopupControl.Cast("popfirst").Hide();
        }
        function setifcheckedallday(s, e) {
            if (s.GetChecked()) {
                // var stime = ASPxClientDateEdit.Cast("FBeginDate").GetText();
                var stime = $("#FBeginDate").val();

                var sout = stime.match(/^\d{4}-\d{2}-\d{2}/);
                if (sout != null) {
                    //ASPxClientDateEdit.Cast("FBeginDate").SetText(sout + " 00:00:00");
                    $("#hstime").val(stime);
                    $("#FBeginDate").val(sout + " 00:00");
                }
                //    var etime = ASPxClientDateEdit.Cast("FEndDate").GetText();
                var etime = $("#FEndDate").val();
                $("#hetime").val(etime);
                var eout = etime.match(/^\d{4}-\d{2}-\d{2}/);
                if (eout != null) {
                    $("#hetime").val(etime);
                    //  ASPxClientDateEdit.Cast("FEndDate").SetText(eout + " 00:00:00");
                    $("#FEndDate").val(eout + " 00:00");
                }
            }
            else {
                // ASPxClientDateEdit.Cast("FBeginDate").SetText($("#hstime").val());
                // ASPxClientDateEdit.Cast("FEndDate").SetText($("#hetime").val());
                if ($("#hstime").val() != "" & $("#hstime").val() != null) {
                    $("#FBeginDate").val($("#hstime").val());
                }

                if ($("#hetime").val() != null & $("#hetime").val() != "") {
                    $("#FEndDate").val($("#hetime").val());
                } 
            }
        }
        function myCalendar(fmt) {
            WdatePicker({
                readOnly: true,
                dateFmt: fmt
            });
        }
       
        function chgid(s, e) {

            ASPxClientPopupControl.Cast("popfirst").Hide();
            var schid = s.GetSelectedValues()[0];
            ASPxClientScheduler.Cast("scheduler").ShowAppointmentFormByServerId(schid);

        }

        function OnAppointmentFormSave(s, e) {
            // if (IsValidAppointment())
            // scheduler.AppointmentFormSave();
            var str = ""
            if ($("#FBeginDate").val().match(/^\d{4}-\d{2}-\d{2}/) == null) {
                str += "请填写正确的开始时间";

            }
            if ($("#FEndDate").val().match(/^\d{4}-\d{2}-\d{2}/) == null) {
                str += "请填写正确的结束时间";

            }
            if (FContents.GetText() == null |$.trim( FContents.GetText()) == "" | $.trim(FTitle.GetText()) == "" | FTitle.GetText() == null) {
                alert(str + "主题或内容不能为空");
            }
            else {

                $.ajax({
                    type: "POST",
                    url: '@Url.Action("Save", "Calendar")',
                    data: $('#form_query1').serialize(),
                    dataType: "json",
                    error: function (data) {
                        alert(data.responseText);
                    },
                    success: function (data) {
                        //  popContent.codeOK(data);
                        scheduler.AppointmentFormCancel();
                        ASPxClientScheduler.Cast("scheduler").Refresh();
                    }
                });
                // form_query1.submit();
            }
        }
    function ctreat()
    {
        //window.showModalDialog( '@Url.Action("calendarlook", "Calendar", new { cid = 97})', window, "dialogWidth=800px;dialogHeight=400px");
        window.showModalDialog('@Url.Action("RemindPopup", "Calendar", new { cid = 97})', window, "dialogWidth=800px;dialogHeight=400px");
 
    }

//         function dismissonea() {
//             $("#popContent").dismissone();
//         }
//         function dismissalla() {
//             $("#popContent").dismissall();
//           }
//           function snoozenowsa() {
//               $("#popContent").snoozenows();
//         }
    </script>
</head>
<script>
    if (top.boardtop) {
        top.boardtop.head_txt.innerText = "日历管理";
    }
</script>
<body>
    <div>
        @Html.DevExpress().Button(
                                settings =>
                                {
                                    settings.Name = "aopen";
                                    settings.Text = "creat";
                                    settings.Width = System.Web.UI.WebControls.Unit.Pixel(91);
                                    settings.ClientSideEvents.Click = "ctreat";
                                   settings.ClientVisible = false;

                                }).GetHtml()
        @Html.Partial("ReportTemplatesPartial", Model)
        @Html.Hidden("hdjsAlert", (ViewData["jsAlert"]))
        @Html.Hidden("htime", ViewData["time"])
        @Html.Hidden("hstime", "")
        @Html.Hidden("hetime", "")
     
            
            @Html.DevExpress().PopupControl(
            settings =>
            {
                settings.Name = "popfirst";
                settings.Styles.Header.Paddings.PaddingBottom = 0;
                settings.Styles.Header.Paddings.PaddingLeft = 240;
                settings.EnableAnimation = false;
                settings.EnableClientSideAPI = true;
                settings.ShowHeader = true;
                settings.Width = System.Web.UI.WebControls.Unit.Pixel(502);
                settings.Height = System.Web.UI.WebControls.Unit.Pixel(220);
                settings.LoadingPanelText = "更新中";
                settings.ShowLoadingPanel = false;
                //  settings.Modal = true;
                settings.Styles.Content.Paddings.Padding = System.Web.UI.WebControls.Unit.Pixel(0);
                // settings.Styles.Footer.VerticalAlign = System.Web.UI.WebControls.VerticalAlign.Top;
                // settings.Styles.Footer.Paddings.PaddingBottom = 0;
                settings.Styles.Footer.Paddings.Padding =0;
                settings.ControlStyle.Paddings.Padding = 0;
                //  settings.Styles.Content.Paddings.PaddingBottom=System.Web.UI.WebControls.Unit.Pixel(0);

                settings.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
                settings.PopupVerticalAlign = PopupVerticalAlign.WindowCenter;
                settings.HeaderText = "提醒";
                settings.ShowFooter = false;
        //        settings.SetFooterTemplateContent(s =>
        //{
        //   // Html.RenderPartial("footerpopup");

        //});
                settings.SetContent(() =>
                {

                   //  ViewContext.Writer.Write("<iframe  id='popContent' name='popContent'scrolling='no' style='width:502px;height:220px;margin-bottom: -3px;' frameborder='0'src=" + @Url.Action("remindpopup", "Calendar") + " ></iframe>");
                   // Html.RenderPartial("remindpopup", ViewData["rmdcdr"]);

                });
            }).GetHtml()
          
        
    </div>
</body>
</html>
